#include<bits/stdc++.h>
#define ll long long
using namespace std;
struct day
{
	int a,b,c;
}a[100005];
int n;
ll dp[100005][5];
int main()
{
	freopen("summer.in","r",stdin);
	freopen("summer.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i].a>>a[i].b>>a[i].c;
	for(int i=1;i<=n;i++)
	{
		dp[i][1]=max(dp[i-1][2],dp[i-1][3])+a[i].a;
		dp[i][2]=max(dp[i-1][1],dp[i-1][3])+a[i].b;
		dp[i][3]=max(dp[i-1][1],dp[i-1][2])+a[i].c;
	}
	cout<<max(dp[n][1],max(dp[n][2],dp[n][3]));
	fclose(stdin);
	fclose(stdout);
	return 0;
}
